<script setup>
import { ref, reactive } from 'vue'
import { useAppStore, useCoreStore, insStoreRefsArray } from '@/stores'
import ReadAgreement from '@/components/ReadAgreement.vue'
import DynamicForm from '@/components/DynamicForm.vue'
import * as yup from 'yup'

const [[appStore], [coreStore]] = insStoreRefsArray([useAppStore, useCoreStore])
const formdata = ref({})
const state = reactive({ loading: false })
const formSchema = ref({
  fields: [
    {
      label: '用户名',
      required: true,
      name: 'organization_name',
      class: 'h-3rem w-24rem',
      as: 'InputText',
      rules: yup.string().required('用户名不能为空')
    },
    {
      label: '手机号',
      required: true,
      rules: yup.string().required('手机号不能为空'),
      class: 'h-3rem w-24rem',
      name: 'organization_hub',
      as: 'InputText'
    },
    {
      label: '登录密码',
      required: true,
      class: 'h-3rem w-24rem',
      name: 'pwd',
      as: 'InputText',
      type: 'password'
    },
    {
      label: '确认登录密码',
      required: true,
      class: 'h-3rem w-24rem',
      name: 'confirm_pwd',
      as: 'InputText',
      type: 'password'
    } /* ,
    {
      label: '验证码',
      required: true,
      class: 'h-3rem w-24rem',
      name: 'organization_types',
      as: 'InputText'
    },
    {
      label: '',
      required: true,
      name: 'readed',
      rules: yup.boolean().isTrue().required('请勾选'),
      as: ReadAgreement
    } */
  ]
})

function onSubmit() {}
</script>
<template>
  <DynamicForm
    class="flex flex-column gap-1"
    :schema="formSchema"
    :formdata="formdata"
    :submitProp="{ label: '下一步', class: 'w-full' }"
    :loading="state.loading"
    :submit="onSubmit"
  />
</template>
